-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - bitdefender_gravityzone #16730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces a Bitdefender GravityZone integration with dynamic property definitions, authenticated JSON-RPC API methods, and several new actions and instant event sources. It includes actions for scanning endpoints, retrieving policy details, moving endpoints between groups, and monitoring scan tasks. Three webhook-based sources emit events for new threats, new endpoints, and new incidents. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant BitdefenderApp
participant BitdefenderAPI
User->>Action: Trigger action (e.g., Scan Endpoint)
Action->>BitdefenderApp: Call API method (e.g., scanEndpoint)
BitdefenderApp->>BitdefenderAPI: Send JSON-RPC request
BitdefenderAPI-->>BitdefenderApp: Return response
BitdefenderApp-->>Action: Return result
Action-->>User: Output summary and data
sequenceDiagram
participant BitdefenderAPI
participant WebhookSource
participant PipedreamPlatform
BitdefenderAPI-->>WebhookSource: Send push event (HTTP POST)
WebhookSource->>WebhookSource: Process event, generate meta
WebhookSource->>PipedreamPlatform: Emit event with metadata
Assessment against linked issues
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/bitdefender_gravityzone/sources/new-endpoint-added-instant/new-endpoint-added-instant.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (11)
components/bitdefender_gravityzone/actions/move-endpoint-to-group/move-endpoint-to-group.mjs (1)
24-39: Consider adding error handling to the API call.The current implementation doesn't include specific error handling. Consider adding try/catch logic to provide more helpful error messages to users when the API call fails.
async run({ $ }) { + try { const response = await this.bitdefender.moveEndpointToGroup({ $, data: { params: { endpointIds: [ this.endpointId, ], groupId: this.groupId, }, }, }); $.export("$summary", `Successfully moved endpoint ${this.endpointId} to group ${this.groupId}`); return response; + } catch (error) { + $.export("$summary", `Failed to move endpoint: ${error.message}`); + throw error; + } }components/bitdefender_gravityzone/sources/new-incident-instant/test-event.mjs (2)
1-34: Well-structured test event but has a trailing comma issue.The test event provides a comprehensive representation of a Bitdefender incident, which is excellent for testing. However, there's a formatting issue:
- "main_action": "no action", - } + "main_action": "no action" + }The trailing comma at the end of the last property in a JSON object might cause parsing issues in some environments.
26-31: Consider adding comments for ATT&CK technique IDs.The ATT&CK IDs (like "T1036", "T1059", etc.) represent specific MITRE ATT&CK techniques. Consider adding comments to explain what each technique ID represents for better developer understanding.
"att_ck_id": [ - "T1036", - "T1059", - "T1002", - "T1012" + "T1036", // Masquerading + "T1059", // Command and Scripting Interpreter + "T1002", // Data Compression + "T1012" // Query Registry ],components/bitdefender_gravityzone/actions/get-policy-details/get-policy-details.mjs (1)
6-6: Fix documentation link formatting.There's a missing closing bracket in the documentation link.
- description: "Retrieve details about a specific policy. [See the documentation](https://www.bitdefender.com/business/support/en/77209-135304-getpolicydetails.html)", + description: "Retrieve details about a specific policy. [See the documentation](https://www.bitdefender.com/business/support/en/77209-135304-getpolicydetails.html)",components/bitdefender_gravityzone/sources/new-endpoint-added-instant/new-endpoint-added-instant.mjs (1)
15-17: Fix indentation inconsistency.The indentation for "endpoint-moved-in" has extra spaces/tabs compared to the rest of the code.
getEventTypes() { return { - "endpoint-moved-in": true, + "endpoint-moved-in": true, }; },components/bitdefender_gravityzone/actions/get-scan-task-status/get-scan-task-status.mjs (1)
6-6: Fix documentation link formatting.There's a missing closing bracket in the documentation link, which will cause incorrect rendering.
- description: "Get the status of a scan task. [See the documentation(https://www.bitdefender.com/business/support/en/77209-440638-gettaskstatus.html)", + description: "Get the status of a scan task. [See the documentation](https://www.bitdefender.com/business/support/en/77209-440638-gettaskstatus.html)",components/bitdefender_gravityzone/sources/common/base.mjs (1)
52-66: Avoid shadowing theeventparameter inside therunloopThe parameter
eventis re-declared in thefor … ofloop, which is legal but confusing.
Renaming the outer argument clarifies intent and removes shadowing.- async run(event) { + async run(reqEvent) { … - const { body } = event; + const { body } = reqEvent; … - for (const event of events) { - const meta = this.generateMeta(event); - this.$emit(event, meta); + for (const e of events) { + const meta = this.generateMeta(e); + this.$emit(e, meta); }components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs (2)
103-107: Static JSON-RPCidrisks collisionsThe constant
"120000"is sent with every call. Some servers use this field to match responses; duplicates can confuse retry logic and tracing. Consider a per-call random or incremental value.- id: "120000", + id: Date.now(), // or uuid.v4()
139-162: Pagination helpers drop next-page information
listPolicies,listEndpoints, etc. expose anoptions()helper that convertsresult.itemsinto a flat array but never returnshasMore/nextPageflags.
Pipedream’s dynamic dropdowns rely on these flags for infinite scroll.Consider returning
{ options, nextPage }wherenextPage = page + 1when the server indicates more pages.components/bitdefender_gravityzone/actions/scan-endpoint/scan-endpoint.mjs (2)
67-68: Fix typo in scan depth option label.The label for the permissive scan depth option contains a typo "Permissivearray" instead of "Permissive".
- label: "Permissivearray", + label: "Permissive", value: 3,
109-109: Improve the summary message to be more user-friendly.The current summary uses numeric scan type and endpoint ID, which isn't very readable. Consider using the scan type label instead of the numeric value.
- $.export("$summary", `Successfully initiated ${this.scanType} scan on endpoint ${this.endpointId}`); + const scanTypeLabels = { + 1: "Quick", + 2: "Full", + 3: "Memory", + 4: "Custom" + }; + $.export("$summary", `Successfully initiated ${scanTypeLabels[this.scanType]} scan on endpoint ${this.endpointId}`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
components/bitdefender_gravityzone/actions/get-policy-details/get-policy-details.mjs(1 hunks)components/bitdefender_gravityzone/actions/get-scan-task-status/get-scan-task-status.mjs(1 hunks)components/bitdefender_gravityzone/actions/move-endpoint-to-group/move-endpoint-to-group.mjs(1 hunks)components/bitdefender_gravityzone/actions/scan-endpoint/scan-endpoint.mjs(1 hunks)components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs(1 hunks)components/bitdefender_gravityzone/package.json(2 hunks)components/bitdefender_gravityzone/sources/common/base.mjs(1 hunks)components/bitdefender_gravityzone/sources/new-endpoint-added-instant/new-endpoint-added-instant.mjs(1 hunks)components/bitdefender_gravityzone/sources/new-endpoint-added-instant/test-event.mjs(1 hunks)components/bitdefender_gravityzone/sources/new-incident-instant/new-incident-instant.mjs(1 hunks)components/bitdefender_gravityzone/sources/new-incident-instant/test-event.mjs(1 hunks)components/bitdefender_gravityzone/sources/new-threat-detected-instant/new-threat-detected-instant.mjs(1 hunks)components/bitdefender_gravityzone/sources/new-threat-detected-instant/test-event.mjs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (13)
components/bitdefender_gravityzone/sources/new-endpoint-added-instant/test-event.mjs (1)
1-11: Test event looks correctly structured and comprehensive.This test event provides a complete set of mock data for simulating an endpoint addition event. The
modulevalue "endpoint-moved-in" correctly identifies the event type.components/bitdefender_gravityzone/package.json (2)
3-3: Version bump appropriate for new component functionality.Increasing from 0.0.1 to 0.1.0 follows semantic versioning principles for adding new features.
14-16: Required Pipedream platform dependency added.Adding the dependency on
@pipedream/platformis necessary for accessing core Pipedream functionality.components/bitdefender_gravityzone/sources/new-threat-detected-instant/test-event.mjs (1)
1-14: Test event has comprehensive threat detection data.The mock data includes all necessary fields for simulating a threat detection event, with appropriate values for testing. The
modulevalue "avc" correctly identifies this as an Anti-Virus Control event.components/bitdefender_gravityzone/actions/move-endpoint-to-group/move-endpoint-to-group.mjs (1)
3-23: Action definition and props look well-structured.The action is properly defined with a clear name, description (including documentation link), and appropriate version. The props leverage propDefinitions from the app module, which is good practice.
components/bitdefender_gravityzone/actions/get-policy-details/get-policy-details.mjs (1)
6-6: Documentation link is properly formatted.The documentation link is correctly formatted with markdown syntax, providing users with direct access to the API reference.
components/bitdefender_gravityzone/sources/new-endpoint-added-instant/new-endpoint-added-instant.mjs (1)
4-12: LGTM - Event source configuration is well-defined.The source module is properly configured with appropriate key, name, description, and dedupe strategy. The source will emit events when new endpoints are registered in Bitdefender GravityZone.
components/bitdefender_gravityzone/actions/get-scan-task-status/get-scan-task-status.mjs (1)
3-9: Action metadata is well-defined.The action module is correctly configured with a descriptive name, appropriate versioning, and type definition.
components/bitdefender_gravityzone/sources/common/base.mjs (1)
34-44: Confirm casing ofserviceType: "jsonRPC"with API docsGravityZone’s docs historically show
serviceTypeas"jsonRpc"(lower-case ‘p’).
Using the wrong casing could silently disable webhook delivery.Please double-check the expected literal in the API reference.
components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs (1)
101-103: Path concatenation may produce an invalid URL
_baseUrl()already ends with/v1.0/jsonrpc. Appending/policies(etc.) yields
…/jsonrpc/policies, whereas the official endpoint is usually just/jsonrpc.
If the API expects the module name inside the JSON-RPCmethodstring rather than the path, the request will 404.Please verify with a quick call or the docs.
components/bitdefender_gravityzone/actions/scan-endpoint/scan-endpoint.mjs (3)
80-87: Validation logic looks good!The validation ensures that scan depth and path are only used for custom scans and that they must be used together. This helps prevent configuration errors.
89-107: Implementation of the scan endpoint call is well structured.The API call is properly implemented with the necessary parameters. The conditional inclusion of customScanSettings when scanDepth is provided is a clean approach.
1-112: Overall, the component is well-implemented.This action for scanning endpoints in Bitdefender GravityZone is well-structured with appropriate validation, error handling, and API integration. It follows Pipedream's component patterns and includes good documentation references.
components/bitdefender_gravityzone/actions/get-policy-details/get-policy-details.mjs
Show resolved
Hide resolved
...ts/bitdefender_gravityzone/sources/new-endpoint-added-instant/new-endpoint-added-instant.mjs
Show resolved
Hide resolved
components/bitdefender_gravityzone/actions/get-scan-task-status/get-scan-task-status.mjs
Show resolved
Hide resolved
components/bitdefender_gravityzone/sources/new-incident-instant/new-incident-instant.mjs
Show resolved
Hide resolved
.../bitdefender_gravityzone/sources/new-threat-detected-instant/new-threat-detected-instant.mjs
Show resolved
Hide resolved
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolves #15122
Summary by CodeRabbit